package fon.test.webservice;
/*
This Activity is for accessing Gugulog API
First, Loading parameters to the object
and Calling API by using its name

setting parameter can be any orders
only necessary parameters will be used
*/
import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.Toast;

public class Webservice_testActivity extends Activity {

	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        String output ="";
        GuGuLog ggl = new GuGuLog();
        //GuGuLog ggl = new GuGuLog();
       /* ggl.AddParam("mail_address", "pantomime@hpguild.com");
        ggl.AddParam("password", "hogehoge");
        //ggl.callGuGuLogAPI("eGGAPIFuncID_TOPBeforLogIn_ShopList");
        ggl.callGuGuLogAPI("eGGAPIFuncID_TOPBeforLogIn_Map");*/
        ggl.AddParam("mail_address", "ariariarix@gmail.com");
        ggl.AddParam("password", "password");
        ggl.AddParam("user_name", "username");
        ggl.AddParam("sex", "1");
        ggl.AddParam("birthday", "1978/05/16");
        ggl.AddParam("user_latitude", "35.68554");
        ggl.AddParam("user_longitude", "139.741617");
        ggl.AddParam("search_word", "カレー");
        ggl.AddParam("user_picture_uri", "http://hpguild.com/img_upload/img/111109152659.jpg");
        
        /* There are five methods have been tested.
         * 	eGGAPIFuncID_TOPBeforLogIn_ShopList("func_id"),
         * 	eGGAPIFuncID_TOPBeforLogIn_Map("func_id"),
         * 	eGGAPIFuncID_LogIn("func_id,mail_address,password"),
         * 	eGGAPIFuncID_LogIn_ForgetPassword("func_id,mail_address"),
         * 	eGGAPIFuncID_SignUp("func_id,mail_address,password,user_name,sex,birthday,user_picture_uri"); 
         */
        ggl.callGuGuLogAPI("eGGAPIFuncID_TOPBeforLogIn_ShopList");
        //output =ggl.getXML();
       /* ArrayList XMLresult = ggl.getArrayResult();
        ArrayList value;
        for(int j=0;j<XMLresult.size();j++){
        	value = (ArrayList) XMLresult.get(j);
            for(int i=0;i<value.size();i++)
            	output += " "+value.get(i);
            output +="\n";
        }
		*/
        HashMap<String,String> mapResult = ggl.getResult(0);
        output = mapResult.get("func_id");
        
        TextView a = (TextView)findViewById(R.id.string_text);
        a.setText(output);
    }
}